package com.yzh.homework.homework02;

/**
 * @author 于振晗
 * @title: programmer
 * @description: TODO 程序员
 * @date 2020年08月25日
 * @path com.yzh.homework.homework02
 */
public class Programmer {
    private String name;
    private int age;
    private String technology;
    private int workYear;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if(age<15){
            System.out.println("年龄信息无效！已经被修改为默认年龄15岁");
            age = 15;
        }
        this.age = age;
    }

    public String getTechnology() {
        return technology;
    }

    public void setTechnology(String technology) {
        this.technology = technology;
    }

    public int getWorkYear() {
        return workYear;
    }

    public void setWorkYear(int workYear) {
        this.workYear = workYear;
    }

    public void work(String unit, String post){
        System.out.println("姓名："+this.name);
        System.out.println("年龄："+this.age);
        System.out.println("技术方向："+this.technology);
        System.out.println("工作年限："+this.workYear);
        System.out.println("目前就职于："+unit);
        System.out.println("职务是："+post);
    }

}


class Test{
    public static void main(String[] args) {
        Programmer p1 = new Programmer();
        p1.setName("马未龙");
        p1.setAge(35);
        p1.setTechnology("数据库维护");
        p1.setWorkYear(10);
        p1.work("腾讯实业","数据库维护工程师");
        System.out.println("======================");
        Programmer p2 = new Programmer();
        p2.setName("张开");
        p2.setAge(10);
        p2.setTechnology("Java开发");
        p2.setWorkYear(1);
        p2.work("登盛科技","Java开发工程师");

    }
}